package a.f.d;

import a.c.ab;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.m;
import a.c.n;
import a.c.q;
import a.c.x;
import a.f.o;

public class k
  extends f
{
  private long p = 9223372036854775807L;
  private int q = 32000;
  private int r = 40;
  private static final int s = 2520;
  private boolean t = false;
  public static boolean u;
  
  public int f()
  {
    return this.q;
  }
  
  public void a(int paramInt)
  {
    this.q = paramInt;
  }
  
  public long g()
  {
    return this.p;
  }
  
  public void a(long paramLong)
  {
    this.p = paramLong;
  }
  
  protected void a(bb[] paramArrayOfbb, a.c.k paramk)
  {
    int i13 = f.o;
    int i12 = f.n;
    a(this.l, paramArrayOfbb);
    int[] arrayOfInt1 = new int[this.l.j()];
    int i = 0;
    label116:
    label118:
    do
    {
      if (i >= paramArrayOfbb.length) {
        break;
      }
      int j = 0;
      a.c.w localw1 = paramArrayOfbb[i].l();
      do
      {
        if (!localw1.e()) {
          break;
        }
        localObject1 = localw1.d();
        int m = ((e)localObject1).f();
        arrayOfInt1[m] = (j++);
        localw1.f();
        if (i13 != 0) {
          break label118;
        }
        if (i12 != 0) {
          break label116;
        }
      } while (i12 == 0);
      if (i13 == 0) {
        i++;
      }
    } while (i12 == 0);
    ab localab = new ab();
    d[] arrayOfd = new d[paramArrayOfbb.length - 1];
    int k = 0;
    do
    {
      do
      {
        if (k >= paramArrayOfbb.length - 1) {
          break label271;
        }
        localObject1 = paramArrayOfbb[k].l();
        if (!((a.c.w)localObject1).e()) {
          break;
        }
      } while (i12 != 0);
      if (((a.c.w)localObject1).d().e() > 0) {}
      while (i13 != 0)
      {
        arrayOfd[k] = ((a.c.w)localObject1).d().h();
        ((a.c.w)localObject1).f();
        if (i12 == 0) {
          break;
        }
      }
      if (arrayOfd[k] == null) {
        localab.add(arrayOfd[k] =  = this.l.a(paramArrayOfbb[k].m(), paramArrayOfbb[(k + 1)].m()));
      }
      k++;
    } while (i12 == 0);
    label271:
    n localn1 = a.i.db.b(new boolean[this.l.l()]);
    h.a(paramArrayOfbb, localn1, this.j, arrayOfInt1);
    Object localObject1 = new q();
    n localn2 = ((q)localObject1).C();
    n localn3 = ((q)localObject1).C();
    n localn4 = ((q)localObject1).C();
    x localx = ((q)localObject1).B();
    e[] arrayOfe1 = new e[this.l.l()];
    e[] arrayOfe2 = new e[this.l.j()];
    int n = 0;
    int i3;
    int i6;
    label549:
    label550:
    Object localObject6;
    label686:
    do
    {
      if (n >= paramArrayOfbb.length) {
        break;
      }
      localObject2 = null;
      Object localObject4 = null;
      i3 = 0;
      if (i12 != 0) {
        break label902;
      }
      a.c.w localw2 = paramArrayOfbb[n].l();
      do
      {
        do
        {
          if (!localw2.e()) {
            break label686;
          }
          e locale1 = localw2.d();
          i6 = locale1.f();
          if (i12 != 0) {
            break;
          }
          if ((this.t) && ((i13 != 0) || (a(this.l, locale1))) && ((i13 != 0) || (a(this.l, locale1.i().e()))) && ((i13 != 0) || (a(this.l, locale1.h().f())))) {
            if (i13 == 0)
            {
              if (!localn1.getBool(locale1.i()))
              {
                if (i13 != 0) {
                  break label549;
                }
                arrayOfe2[i6] = arrayOfe2[locale1.i().e().f()];
              }
            }
            else {
              if (i12 == 0) {
                break label550;
              }
            }
          }
          arrayOfe2[i6] = ((q)localObject1).i();
          if (i13 == 0)
          {
            if (localObject2 != null)
            {
              localObject6 = ((q)localObject1).a((e)localObject2, arrayOfe2[i6]);
              localn4.a(localObject6, true);
              localn2.a(localObject6, 0);
              int i8 = (int)(2520.0D * (o((e)localObject4) + (this.l.s((e)localObject4) + this.l.s(locale1)) * 0.5D));
              localn3.a(localObject6, i8);
              i3 += i8;
            }
            localx.a(arrayOfe2[i6], i3);
            localObject2 = arrayOfe2[i6];
          }
          localObject4 = locale1;
          localw2.f();
        } while (i12 == 0);
        n++;
      } while (i13 != 0);
    } while (i12 == 0);
    if (i13 == 0)
    {
      if (i13 != 0) {
        break label909;
      }
      if (!this.t)
      {
        n = 0;
        label897:
        label899:
        do
        {
          if (n >= paramArrayOfbb.length - 1) {
            break;
          }
          localObject2 = arrayOfd[n];
          double d1 = this.l.p((d)localObject2).a();
          double d2 = this.l.q((d)localObject2).a();
          if (i12 != 0) {
            break label909;
          }
          i6 = localx.getInt(arrayOfe2[localObject2.e().f()]) - localx.getInt(arrayOfe2[localObject2.f().f()]) + (int)(2520.0D * (d1 - d2));
          localObject6 = paramArrayOfbb[(n + 1)].l();
          do
          {
            if (!((a.c.w)localObject6).e()) {
              break;
            }
            e locale5 = ((a.c.w)localObject6).d();
            int i10 = locale5.f();
            a(arrayOfe2[i10], localx, i6);
            ((a.c.w)localObject6).f();
            if (i13 != 0) {
              break label899;
            }
            if (i12 != 0) {
              break label897;
            }
          } while (i12 == 0);
          if (i13 == 0) {
            n++;
          }
        } while (i12 == 0);
      }
    }
    label902:
    label909:
    int[] arrayOfInt2 = new int[this.l.l()];
    Object localObject2 = this.l.v();
    int i2;
    d locald1;
    e locale3;
    label1124:
    do
    {
      do
      {
        if (!((a.c.w)localObject2).e()) {
          break;
        }
        if (i12 != 0) {
          break label1234;
        }
        i2 = (((a.c.w)localObject2).d().e() & 0x1) == 1 ? 1 : 0;
        i3 = -((a.c.w)localObject2).d().e() / 2;
        locald1 = ((a.c.w)localObject2).d().h();
        if (locald1 != null) {
          if (i13 != 0) {
            break label1542;
          }
        }
        do
        {
          int i5 = locald1.d();
          locale3 = arrayOfe2[locald1.e().f()];
          localObject6 = arrayOfe2[locald1.f().f()];
          if (i12 != 0) {
            break label1539;
          }
          if (locale3 != localObject6)
          {
            int i9 = this.r;
            if (i13 == 0) {
              if (!localn1.getBool(locald1))
              {
                boolean bool1 = a(this.l, locald1.e());
                boolean bool2 = a(this.l, locald1.f());
                if (i13 != 0) {
                  break label1124;
                }
                if (bool1)
                {
                  if (i13 != 0) {
                    break label1124;
                  }
                  if (bool2) {
                    i9 = this.q;
                  }
                }
              }
            }
            if (((i13 != 0) || (i2 != 0)) && ((i13 != 0) || (i3 == 0))) {
              i9 += this.r * 4;
            }
            arrayOfInt2[i5] = i9;
          }
          locald1 = locald1.i();
          i3++;
          if (i12 == 0) {
            break;
          }
          ((a.c.w)localObject2).f();
        } while (i13 != 0);
      } while (i12 == 0);
    } while (i13 != 0);
    localObject2 = this.l.v();
    label1234:
    e locale2;
    do
    {
      if (!((a.c.w)localObject2).e()) {
        break;
      }
      if (i12 != 0) {
        break label1529;
      }
      i2 = (((a.c.w)localObject2).d().d() & 0x1) == 1 ? 1 : 0;
      if (i13 == 0)
      {
        if (i2 != 0)
        {
          i3 = -((a.c.w)localObject2).d().d() / 2;
          locald1 = ((a.c.w)localObject2).d().i();
          do
          {
            if (locald1 == null) {
              break;
            }
            locale2 = arrayOfe2[locald1.e().f()];
            locale3 = arrayOfe2[locald1.f().f()];
            if (i12 != 0) {
              break label1539;
            }
            if (locale2 != locale3)
            {
              if (i13 != 0) {
                continue;
              }
              if (i3 == 0)
              {
                int i7 = locald1.d();
                arrayOfInt2[i7] += this.r * 4;
              }
            }
            locald1 = locald1.j();
            i3++;
          } while (i12 == 0);
        }
        ((a.c.w)localObject2).f();
        if (i13 != 0) {
          break label1529;
        }
      }
    } while (i12 == 0);
    Object localObject5;
    label1539:
    label1542:
    label1544:
    label1849:
    label1868:
    if (i13 == 0)
    {
      localObject2 = this.l.w();
      do
      {
        if (!((m)localObject2).e()) {
          break;
        }
        localObject5 = ((m)localObject2).a();
        i3 = ((d)localObject5).d();
        tmp1434_1432 = i3;
        tmp1434_1430 = arrayOfInt2;
        tmp1434_1430[tmp1434_1432] = ((int)(tmp1434_1430[tmp1434_1432] * (1.0D - 0.1D * Math.min(8, ((d)localObject5).e().e() + ((d)localObject5).f().d() - 2))));
        if (i13 == 0)
        {
          if (localn1.getBool(localObject5))
          {
            tmp1492_1490 = i3;
            tmp1492_1488 = arrayOfInt2;
            tmp1492_1488[tmp1492_1490] = ((int)(tmp1492_1488[tmp1492_1490] * 0.5D));
          }
          ((m)localObject2).f();
        }
      } while (i12 == 0);
      localObject2 = this.l.v();
      label1529:
      label1915:
      do
      {
        if (!((a.c.w)localObject2).e()) {
          break;
        }
        localObject5 = ((a.c.w)localObject2).d().h();
        if (localObject5 != null) {}
        do
        {
          i3 = ((d)localObject5).d();
          int i4 = arrayOfInt2[i3];
          if (i12 != 0) {
            break;
          }
          if (i4 > 0)
          {
            locale2 = arrayOfe2[localObject5.e().f()];
            locale3 = arrayOfe2[localObject5.f().f()];
            e locale4 = ((q)localObject1).i();
            arrayOfe1[i3] = locale4;
            d locald2 = ((q)localObject1).a(locale4, locale2);
            d locald3 = ((q)localObject1).a(locale4, locale3);
            localn2.a(locald2, i4);
            localn2.a(locald3, i4);
            double d3 = 2520.0D * this.l.p((d)localObject5).a();
            double d4 = 2520.0D * this.l.q((d)localObject5).a();
            if (i13 == 0) {
              if (d3 > d4)
              {
                i11 = (int)Math.rint(d3 - d4);
                localn3.a(locald2, 0);
                localn3.a(locald3, i11);
                localx.a(locale4, Math.min(localx.getInt(locale2), localx.getInt(locale3) - i11));
                if (i13 != 0) {
                  break label1868;
                }
                if (i12 == 0) {
                  break label1849;
                }
              }
            }
            int i11 = (int)Math.rint(d4 - d3);
            localn3.a(locald2, i11);
            localn3.a(locald3, 0);
            localx.a(locale4, Math.min(localx.getInt(locale2) - i11, localx.getInt(locale3)));
            if (i13 == 0)
            {
              if (localx.getInt(locale2) - localx.getInt(locale4) == localn3.getInt(locald2)) {
                localn4.a(locald2, true);
              }
            }
            else
            {
              if (i13 != 0) {
                break label1924;
              }
              if (i12 == 0) {
                break label1915;
              }
            }
            localn4.a(locald3, true);
          }
          localObject5 = ((d)localObject5).i();
          if (i12 == 0) {
            break label1544;
          }
          ((a.c.w)localObject2).f();
        } while (i13 != 0);
      } while (i12 == 0);
    }
    label1924:
    arrayOfInt2 = null;
    if (i13 == 0)
    {
      if (!this.t)
      {
        int i1 = 0;
        do
        {
          if (i1 >= paramArrayOfbb.length - 1) {
            break;
          }
          localObject5 = arrayOfd[i1];
          if (i13 != 0) {
            break label2123;
          }
          if (i12 != 0) {
            break label2104;
          }
          m localm = arrayOfe1[localObject5.d()].n();
          if (localm.e())
          {
            localn4.a(localm.a(), true);
            localm.f();
          }
          for (;;)
          {
            if (i13 == 0) {
              if (i12 == 0)
              {
                if (i12 == 0) {
                  break;
                }
                if (i13 != 0) {
                  continue;
                }
                i1++;
              }
            }
          }
        } while (i12 == 0);
      }
      if (i13 != 0) {}
    }
    else if (i13 == 0)
    {
      if (this.t)
      {
        a.a.db.a((q)localObject1, localx, localn2, localn3, this.p);
        if ((i13 == 0) && (i12 == 0)) {
          break label2124;
        }
      }
    }
    label2104:
    label2123:
    a.a.db.a((q)localObject1, localx, localn2, localn3, localn4, null, true, this.p);
    label2124:
    Object localObject3 = this.l.v();
    do
    {
      if (!((a.c.w)localObject3).e()) {
        break;
      }
      localObject5 = ((a.c.w)localObject3).d();
      this.l.a((e)localObject5, localx.getInt(arrayOfe2[localObject5.f()]) / 2520.0D, this.l.n((e)localObject5));
      ((a.c.w)localObject3).f();
    } while (i12 == 0);
    localObject3 = localab.l();
    do
    {
      while (i12 == 0)
      {
        if (!((m)localObject3).e()) {
          break;
        }
        this.l.a(((m)localObject3).a());
        ((m)localObject3).f();
      }
    } while (i13 != 0);
    if (q.o)
    {
      i13++;
      f.o = i13;
    }
  }
  
  protected int a(q paramq, x paramx, n paramn1, n paramn2)
  {
    int k = f.o;
    int j = f.n;
    int i = 0;
    m localm = paramq.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (k == 0)
      {
        if (j != 0) {
          break label109;
        }
        i += (paramx.getInt(locald.f()) - paramx.getInt(locald.e()) - paramn2.getInt(locald)) * paramn1.getInt(locald);
        localm.f();
      }
    } while (j == 0);
    label109:
    return i;
  }
  
  private static void a(e parame, x paramx, int paramInt)
  {
    paramx.a(parame, paramx.getInt(parame) + paramInt);
  }
  
  protected static boolean a(o paramo, e parame)
  {
    int i = f.o;
    if (i == 0) {
      if (paramo.s(parame) > 1.0D) {
        return false;
      }
    }
    if (i == 0) {
      if (parame.d() == 1)
      {
        if (i != 0) {
          break label47;
        }
        if (parame.e() == 1) {
          return true;
        }
      }
    }
    label47:
    return false;
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.f.d.k
 * JD-Core Version:    0.7.0.1
 */